package pe.edu.upc.dsd.whereeat.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import pe.edu.upc.dsd.whereeat.base.dao.impl.BaseDAOImpl;
import pe.edu.upc.dsd.whereeat.dao.CategoriaDAO;
import pe.edu.upc.dsd.whereeat.domain.Categoria;

@Repository
public class CategoriaDAOImpl extends BaseDAOImpl<Categoria, Integer> implements
		CategoriaDAO {

	public Categoria find(Categoria object) throws Exception {
		String queryString = "SELECT cp from Categoria cp where cp.codigo=? ";
		return findSingleObject(queryString,
				new Object[] { object.getCodigo() });
	}

	public List<Categoria> findAll() throws Exception {
		String queryString = "SELECT cp from Categoria cp where cp.estado='A'";
		return executeQuery(queryString);
	}

}
